package org.xxpay.pay.channel.xypay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * 四方：兴源支付
 */
@Component
public class XypayConfig {

    public static final String CHANNEL_NAME = "xypay";
    protected final static String CHANNEL_NAME_ALIPAY_H5 = CHANNEL_NAME + "_alipay_h5";   // 支付宝h5

    public static final String RETURN_VALUE_SUCCESS = "success";    //回调返回状态
    public static final String RETURN_VALUE_ERROR = "error";

    // 商户号(Token)
    private String mchId;
    // 密钥(Secret)
    private String key;
    // 请求地址
    private String reqUrl;

    public XypayConfig(){}

    public XypayConfig(String payParam) {
        Assert.notNull(payParam, "init " + CHANNEL_NAME +" config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.mchId = object.getString("mchId");
        this.key = object.getString("key");
        this.reqUrl = object.getString("reqUrl");
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getReqUrl() {
        return reqUrl;
    }

    public void setReqUrl(String reqUrl) {
        this.reqUrl = reqUrl;
    }
}
